﻿using System;
using System.Collections.Generic;
using System.Text;
using Torch.WL.Business.Interface;
using Torch.FrameWork.Utility;

namespace Torch.WL.Business
{
    public class LoginProvider : BaseProvider<LoginProvider.RequestDataInfo>, IDataProvider
    {
        public LoginProvider(string _jsonInfo): base(_jsonInfo)
        {
        }

        public IMessageInfo Do()
        {

            IMessageInfo message = new MessageInfo();
            message.code = (int)MessageCodeType.Success;
            message.message = Utils.GetEnumDescription(MessageCodeType.Success);
            message.data = ProcessResponseData();

            return message;            
        }

        private List<ResponseDataInfo> ProcessResponseData()
        {
            //use postdata.data to process responseData
            List<ResponseDataInfo> list = new List<ResponseDataInfo>();
            ResponseDataInfo responseData = new ResponseDataInfo();
            responseData.content = "内容";
            responseData.cust_id = 100;
            responseData.date = "2013-12-13 08:08";
            list.Add(responseData);

            responseData = new ResponseDataInfo();
            responseData.content = "内容2";
            responseData.cust_id = 200;
            responseData.date = "2013-12-14 08:08";
            list.Add(responseData);

            return list; 
        }

        public class RequestDataInfo
        {
            public string content { get; set; }
            public int cust_id { get; set; }
        }

        public class ResponseDataInfo
        {
            public string content { get; set; }
            public int cust_id { get; set; }
            //DateTime类型统一以文本返回
            public string date { get; set; }
        }



    }
}
